package roborally.model.filters;

import roborally.model.*;

public class SubrangeFilter extends ElementFilter{
	
	private final Position firstBound;
	private final Position secondBound;
	
	public SubrangeFilter(Position firstBound, Position secondBound){
		this.firstBound = firstBound;
		this.secondBound = secondBound;
	}
	
	@Override
	public boolean validate(Element element){
		if(element == null || element.getField() == null) return false;
		return element.getField().getPosition().withinRectangleDefinedBy(this.firstBound, this.secondBound);
	}
}
